<?php
include_once 'include/control/context.php.inc';
include_once 'include/model/Post.php';
include_once 'include/control/JobControl.php';

$control= new JobControl($current_usr);
$job = $control->job;
$replies = $control->replies;

$title= $job-> title . ' itjobs.sinaapp.com';
$keywords = $job-> title;
$description = $job-> title;

include_once 'include/parts/header.php.inc';
include_once 'include/parts/jobcategories.php';
?>

<div id="right">
	<div class="pt10 pb15"><h1><?php echo $job-> title; ?></h1></div>

	<!--职位介绍-->
	<div class="pt10">
		<p>发布者：<a href="/hr/<?php echo $job->User->id ;?>"><?php echo $job->User->name;?></a>	
		<?php if($current_usr && $current_usr->id == $job->User->id ) {
			echo '<a href="/job/'.$job->id.'/edit">edit</a>';
		}?>
		</p>
		<?php echo nl2br($job-> body); ?>
		<?php if($current_usr) {?>
		<div class="send_cmt_box round_15 mt15 p15">
			<div class="l"><img src="<?php echo $current_usr->profile_image_url; ?>" alt="<?php echo $current_usr->name; ?>" /></div>
			<div class="r">
				<form action="/reply.php" method="post"><input name="post_id" type="hidden" value="<?php echo $job->id; ?>" />
				<p><textarea name="content" cols="45" rows="5" class="textarea">请输入评论内容...</textarea></p>
				<p class="pt5 tr"><label><input name="needSyn" type="checkbox" checked />同步到新浪微博</label>
				<input type="submit" class="orange_btn round_10" value="发表评论" title="发表评论" /></p>
				</form>
			</div>
		<div class="clear"></div>
		</div>
		<?php }?>
	</div>
	
	<!--Content-->
	<div id="job_list" class="mt20">
	<div class="list">
		<ul>
		<?php	
		if($replies){
			$index=1;
			foreach ($replies as $reply){
				echo '<li>';
				echo '<div class="l"><a href="/u/'. $reply->User->id .'"><img src="'. $reply->User->profile_image_url.'" alt="'. $reply->User->name .'" /></a></div>';
				echo '<div class="r">';
				echo '  <p><span class="pr10 t12">#'. $index .'</span><a href="/u/'. $reply->User->id .'">' .$reply->User->name . '</a><span class="pl20 t12 normal l_black">'. $reply-> reply_date .'</span></p>';
				echo '  <p class="pt5">'. $reply->content .'</p>';
				echo ' </div>';
				echo ' </li>';
				
				$index++;
			}
		}
		?>
		</ul>
	<div class="paging mt20">
	<p class="right"><a href="#" class="on">1</a><a href="#">2</a><a
		href="#">3</a><a href="#">4</a><a href="#">...</a><a href="#">12</a><a
		href="#">13</a><a href="#">14</a><a href="#">下一页</a></p>
	<p>第&nbsp;<strong>1</strong>-<strong>25</strong>&nbsp;个，共&nbsp;<strong>114</strong>&nbsp;个</p>
	</div>
	</div>
	</div>
</div>

<script type="text/javascript">
<!--
var category_id='<?php echo $job-> category_id ;?>';
//-->
</script>

<?php
include_once 'include/parts/footer.php.inc';
?>